/***************************************************************************
                          defs.h  -  Part of gltris
                             -------------------
    begin                : March 2001
    copyright            : (C) 2001 by David Delbecq (Alias Tchize)
    email                : david.delbecq@usa.net
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/****************************************************************************
* See associated .c file for functions description.                         *
****************************************************************************/
#ifndef _defs_h_
#define _defs_h_

#define true 1==1
#define false 1==0
#include <time.h>
#include <GL/gl.h>

/*
 * Here follows some compilation options
 * Uncomment them to activate.
 * Comment to de-activate
 */

 #define SHOW_FPS
/* Used to show frame rate on screen
 */

 #define DEMO_MODE
/* This force players to have all bonuses at start-up
 */

#define DEBUG
/* #define DEBUG
 * Output a lot of ugly debugging tracking in the code.
 * This code slowdowns the game because of its verbosity.
 * The output should be redirected to a file!
 */

typedef GLfloat vecteur[3];
typedef void (*callback_void)(void);
typedef void (*callback_int)(int);

typedef struct
        {
        float prob;
        int item;
        } TProbItem;

typedef struct
        {
        float MaxProb;
        int itemcount;
        TProbItem *items;
        } TProbList;

struct TSynchro
        {
        clock_t lastclock;    //State of clock () at last check
        float lastsec;        //Unused sec
        float period;         //Frequency of execution
        };

//prototypes
#define RandRange RandRangei
int getSyncSteps (struct TSynchro *sync);
int getUniqueNumbers (int count);
int RandRangei (int min,int max);   //return an integer in the range [min,max]
float RandRangef (float min, float max);  //return a float in the range [min,max]
void InitialiseProbs (TProbList * liste); //Initialise une liste de probabilit閟
int GetAProb (TProbList liste); //Renvoie un 閘閙ent suivant les probabilit閟
void swapi (int *a, int *b);
void swapf (float *a, float *b);

#endif
